import 'package:flutter/material.dart';
import 'package:flutter_default_project/screens/add_edit_screen.dart';

import 'package:key_value_store_flutter/key_value_store_flutter.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:todos_app_core/todos_app_core.dart';
import 'package:todos_repository_local_storage/todos_repository_local_storage.dart';

import 'screens/home_screen.dart';
import 'state_container.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(
    StateContainer(
      repository: LocalStorageRepository(
        localStorage: KeyValueStorage(
          'inherited_widget_todos',
          FlutterKeyValueStore(await SharedPreferences.getInstance()),
        ),
      ),

      child: MaterialApp(
        // initialRoute: ArchSampleRoutes.home,
        routes: {
          ArchSampleRoutes.home: (context) => HomeScreen(),
          ArchSampleRoutes.addTodo: (context) => AddEditScreen(),
        },
      ),
    ),
  );
}
